package simplyrugby.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import simplyrugby.entity.Season;
import simplyrugby.mapper.SeasonMapper;
import simplyrugby.service.SeasonService;

/**
* @author admin
* @description 针对表【season】的数据库操作Service实现
* @createDate 2025-03-31 17:57:37
*/
@Service
public class SeasonServiceImpl extends ServiceImpl<SeasonMapper, Season>
    implements SeasonService{

    @Override
    public Page<Season> list(Integer pageNum, Integer pageSize, Season season) {
        LambdaQueryWrapper<Season> wrapper = Wrappers.lambdaQuery(Season.class)
                .eq(!ObjectUtils.isEmpty(season.getId()), Season::getId, season.getId())
                .like(!ObjectUtils.isEmpty(season.getName()), Season::getName, season.getName());

        Page<Season> page = new Page<>(pageNum, pageSize);
        this.page(page, wrapper);
        return page;
    }
}




